/********************************************************************
FileName    :   Dal_UserArchives.cs
CreateTime  :   2015-10-23 10:10
BaseClass   :   Dal_UserArchives
FileType    :   .cs
Author      :  minjie
Description :   Dal_UserArchivesDAL层（简单三层）
*********************************************************************/

using System;
using System.Text;
using System.Data.SqlClient;
using System.Collections.Generic;

using System.Data;
namespace OS.DAL
{
	/// <summary>
	/// Dal_UserArchives的摘要说明。
	/// </summary>
	public partial class Dal_UserArchives 
  	{ 
     		      
  	 

        public bool Exists(string Id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from UserArchives");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.VarChar, 50) }; 
            parameters[0].Value = Id;  
            return DbHelperSQL.Exists(strSql.ToString(), parameters);



        }

  				 
  		 
  		/// <summary> 
  		/// 增加一条数据 
  		/// </summary> 
  		public  bool  Add(UserArchives_Entity model) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("insert into UserArchives(");			 
  	strSql.Append("Id,Type,Pwd,Name,Sex,Email,Tel,MobilePhone,dept,Status,Birthday,Birthplace,Address,Objects,Siren,IsLeader,IDNumber,Office,Responsibilities,VirtualNumber,RoomNumber,DiskSize,DeptTelephone,Photo) values ("); 
  	strSql.Append("	@Id,@Type,@Pwd,@Name,@Sex,@Email,@Tel,@MobilePhone,@dept,@Status,@Birthday,@Birthplace,@Address,@Objects,@Siren,@IsLeader,@IDNumber,@Office,@Responsibilities,@VirtualNumber,@RoomNumber,@DiskSize,@DeptTelephone,@Photo	 ) "); 
  			SqlParameter[] parameters = { 
              new SqlParameter("@Id", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Type", SqlDbType.Int,4) ,              
              new SqlParameter("@Pwd", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Name", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Sex", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Email", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Tel", SqlDbType.VarChar,50) ,              
              new SqlParameter("@MobilePhone", SqlDbType.VarChar,50) ,              
              new SqlParameter("@dept", SqlDbType.Int,4) ,              
              new SqlParameter("@Status", SqlDbType.Int,4) ,              
              new SqlParameter("@Birthday", SqlDbType.DateTime) ,              
              new SqlParameter("@Birthplace", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Address", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Objects", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Siren", SqlDbType.VarChar,50) ,              
              new SqlParameter("@IsLeader", SqlDbType.Int,4) ,              
              new SqlParameter("@IDNumber", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Office", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Responsibilities", SqlDbType.VarChar,50) ,              
              new SqlParameter("@VirtualNumber", SqlDbType.VarChar,50) ,              
              new SqlParameter("@RoomNumber", SqlDbType.VarChar,50) ,              
              new SqlParameter("@DiskSize", SqlDbType.Decimal,9) ,              
              new SqlParameter("@DeptTelephone", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Photo", SqlDbType.VarChar,50)};             
           if (model.Id != null)  
              parameters[0].Value = model.Id;  
           else  
              parameters[0].Value = DBNull.Value;  
              
           if (model.Type != null)  
              parameters[1].Value = model.Type;  
           else  
              parameters[1].Value = DBNull.Value;  
              
           if (model.Pwd != null)  
              parameters[2].Value = model.Pwd;  
           else  
              parameters[2].Value = DBNull.Value;  
              
           if (model.Name != null)  
              parameters[3].Value = model.Name;  
           else  
              parameters[3].Value = DBNull.Value;  
              
           if (model.Sex != null)  
              parameters[4].Value = model.Sex;  
           else  
              parameters[4].Value = DBNull.Value;  
              
           if (model.Email != null)  
              parameters[5].Value = model.Email;  
           else  
              parameters[5].Value = DBNull.Value;  
              
           if (model.Tel != null)  
              parameters[6].Value = model.Tel;  
           else  
              parameters[6].Value = DBNull.Value;  
              
           if (model.MobilePhone != null)  
              parameters[7].Value = model.MobilePhone;  
           else  
              parameters[7].Value = DBNull.Value;  
              
           if (model.dept != null)  
              parameters[8].Value = model.dept;  
           else  
              parameters[8].Value = DBNull.Value;  
              
           if (model.Status != null)  
              parameters[9].Value = model.Status;  
           else  
              parameters[9].Value = DBNull.Value;  
              
           if (model.Birthday != null)  
              parameters[10].Value = model.Birthday;  
           else  
              parameters[10].Value = DBNull.Value;  
              
           if (model.Birthplace != null)  
              parameters[11].Value = model.Birthplace;  
           else  
              parameters[11].Value = DBNull.Value;  
              
           if (model.Address != null)  
              parameters[12].Value = model.Address;  
           else  
              parameters[12].Value = DBNull.Value;  
              
           if (model.Objects != null)  
              parameters[13].Value = model.Objects;  
           else  
              parameters[13].Value = DBNull.Value;  
              
           if (model.Siren != null)  
              parameters[14].Value = model.Siren;  
           else  
              parameters[14].Value = DBNull.Value;  
              
           if (model.IsLeader != null)  
              parameters[15].Value = model.IsLeader;  
           else  
              parameters[15].Value = DBNull.Value;  
              
           if (model.IDNumber != null)  
              parameters[16].Value = model.IDNumber;  
           else  
              parameters[16].Value = DBNull.Value;  
              
           if (model.Office != null)  
              parameters[17].Value = model.Office;  
           else  
              parameters[17].Value = DBNull.Value;  
              
           if (model.Responsibilities != null)  
              parameters[18].Value = model.Responsibilities;  
           else  
              parameters[18].Value = DBNull.Value;  
              
           if (model.VirtualNumber != null)  
              parameters[19].Value = model.VirtualNumber;  
           else  
              parameters[19].Value = DBNull.Value;  
              
           if (model.RoomNumber != null)  
              parameters[20].Value = model.RoomNumber;  
           else  
              parameters[20].Value = DBNull.Value;  
              
           if (model.DiskSize != null)  
              parameters[21].Value = model.DiskSize;  
           else  
              parameters[21].Value = DBNull.Value;  
              
           if (model.DeptTelephone != null)  
              parameters[22].Value = model.DeptTelephone;  
           else  
              parameters[22].Value = DBNull.Value;  
              
           if (model.Photo != null)  
              parameters[23].Value = model.Photo;  
           else  
              parameters[23].Value = DBNull.Value;  
              
  			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);			 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
              return false;; 
           }  
  		} 
  		 
  		/// <summary> 
  		/// 增加一条数据(字符串) 
  		/// </summary> 
  		public  string  AddStr(UserArchives_Entity model) 
  		{ 
  				if(model.Id==null) 
  				{ 
  					model.Id="";  
  				} 
  				if(model.UserId==null) 
  				{ 
  					model.UserId=0; 
  				} 
  				if(model.Type==null) 
  				{ 
  					model.Type=0; 
  				} 
  				if(model.Pwd==null) 
  				{ 
  					model.Pwd="";  
  				} 
  				if(model.Name==null) 
  				{ 
  					model.Name="";  
  				} 
  				if(model.Sex==null) 
  				{ 
  					model.Sex="";  
  				} 
  				if(model.Email==null) 
  				{ 
  					model.Email="";  
  				} 
  				if(model.Tel==null) 
  				{ 
  					model.Tel="";  
  				} 
  				if(model.MobilePhone==null) 
  				{ 
  					model.MobilePhone="";  
  				} 
  				if(model.dept==null) 
  				{ 
  					model.dept=0; 
  				} 
  				if(model.Status==null) 
  				{ 
  					model.Status=0; 
  				} 
  				if(model.Birthplace==null) 
  				{ 
  					model.Birthplace="";  
  				} 
  				if(model.Address==null) 
  				{ 
  					model.Address="";  
  				} 
  				if(model.Objects==null) 
  				{ 
  					model.Objects="";  
  				} 
  				if(model.Siren==null) 
  				{ 
  					model.Siren="";  
  				} 
  				if(model.IsLeader==null) 
  				{ 
  					model.IsLeader=0; 
  				} 
  				if(model.IDNumber==null) 
  				{ 
  					model.IDNumber="";  
  				} 
  				if(model.Office==null) 
  				{ 
  					model.Office="";  
  				} 
  				if(model.Responsibilities==null) 
  				{ 
  					model.Responsibilities="";  
  				} 
  				if(model.VirtualNumber==null) 
  				{ 
  					model.VirtualNumber="";  
  				} 
  				if(model.RoomNumber==null) 
  				{ 
  					model.RoomNumber="";  
  				} 
  				if(model.DiskSize==null) 
  				{ 
  					model.DiskSize=0; 
  				} 
  				if(model.DeptTelephone==null) 
  				{ 
  					model.DeptTelephone="";  
  				} 
  				if(model.Photo==null) 
  				{ 
  					model.Photo="";  
  				} 
  		 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("insert into UserArchives(");			 
  	strSql.Append("Id,Type,Pwd,Name,Sex,Email,Tel,MobilePhone,dept,Status,Birthday,Birthplace,Address,Objects,Siren,IsLeader,IDNumber,Office,Responsibilities,VirtualNumber,RoomNumber,DiskSize,DeptTelephone,Photo) values ("); 
  	strSql.Append("	'"+ model.Id+"',"+ model.UserId+","+ model.Type+",'"+ model.Pwd+"','"+ model.Name+"','"+ model.Sex+"','"+ model.Email+"','"+ model.Tel+"','"+ model.MobilePhone+"',"+ model.dept+","+ model.Status+",'"+ model.Birthday+"','"+ model.Birthplace+"','"+ model.Address+"','"+ model.Objects+"','"+ model.Siren+"',"+ model.IsLeader+",'"+ model.IDNumber+"','"+ model.Office+"','"+ model.Responsibilities+"','"+ model.VirtualNumber+"','"+ model.RoomNumber+"',"+ model.DiskSize+",'"+ model.DeptTelephone+"','" +model.Photo+"'	 ) "); 
           return strSql.ToString(); 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 更新一条数据 
  		/// </summary> 
  		public bool Update(UserArchives_Entity model) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("update UserArchives set "); 
              strSql.Append(" Id = @Id,"); 
              strSql.Append(" Type = @Type,"); 
              strSql.Append(" Pwd = @Pwd,"); 
              strSql.Append(" Name = @Name,"); 
              strSql.Append(" Sex = @Sex,"); 
              strSql.Append(" Email = @Email,"); 
              strSql.Append(" Tel = @Tel,"); 
              strSql.Append(" MobilePhone = @MobilePhone,"); 
              strSql.Append(" dept = @dept,"); 
              strSql.Append(" Status = @Status,"); 
              strSql.Append(" Birthday = @Birthday,"); 
              strSql.Append(" Birthplace = @Birthplace,"); 
              strSql.Append(" Address = @Address,"); 
              strSql.Append(" Objects = @Objects,"); 
              strSql.Append(" Siren = @Siren,"); 
              strSql.Append(" IsLeader = @IsLeader,"); 
              strSql.Append(" IDNumber = @IDNumber,"); 
              strSql.Append(" Office = @Office,"); 
              strSql.Append(" Responsibilities = @Responsibilities,"); 
              strSql.Append(" VirtualNumber = @VirtualNumber,"); 
              strSql.Append(" RoomNumber = @RoomNumber,"); 
              strSql.Append(" DiskSize = @DiskSize,"); 
              strSql.Append(" DeptTelephone = @DeptTelephone,"); 
              strSql.Append(" Photo = @Photo"); 
  			strSql.Append(" where  Id=@Id "); 
  						 
  SqlParameter[] parameters = { 
              new SqlParameter("@Id", SqlDbType.VarChar,50) ,              
              new SqlParameter("@UserId", SqlDbType.Int,4) ,              
              new SqlParameter("@Type", SqlDbType.Int,4) ,              
              new SqlParameter("@Pwd", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Name", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Sex", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Email", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Tel", SqlDbType.VarChar,50) ,              
              new SqlParameter("@MobilePhone", SqlDbType.VarChar,50) ,              
              new SqlParameter("@dept", SqlDbType.Int,4) ,              
              new SqlParameter("@Status", SqlDbType.Int,4) ,              
              new SqlParameter("@Birthday", SqlDbType.DateTime) ,              
              new SqlParameter("@Birthplace", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Address", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Objects", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Siren", SqlDbType.VarChar,50) ,              
              new SqlParameter("@IsLeader", SqlDbType.Int,4) ,              
              new SqlParameter("@IDNumber", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Office", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Responsibilities", SqlDbType.VarChar,50) ,              
              new SqlParameter("@VirtualNumber", SqlDbType.VarChar,50) ,              
              new SqlParameter("@RoomNumber", SqlDbType.VarChar,50) ,              
              new SqlParameter("@DiskSize", SqlDbType.Decimal,9) ,              
              new SqlParameter("@DeptTelephone", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Photo", SqlDbType.VarChar,50)};             
           if (model.Id != null)  
              parameters[0].Value = model.Id;  
           else  
              parameters[0].Value = DBNull.Value;  
              
           if (model.UserId != null)  
              parameters[1].Value = model.UserId;  
           else  
              parameters[1].Value = DBNull.Value;  
              
           if (model.Type != null)  
              parameters[2].Value = model.Type;  
           else  
              parameters[2].Value = DBNull.Value;  
              
           if (model.Pwd != null)  
              parameters[3].Value = model.Pwd;  
           else  
              parameters[3].Value = DBNull.Value;  
              
           if (model.Name != null)  
              parameters[4].Value = model.Name;  
           else  
              parameters[4].Value = DBNull.Value;  
              
           if (model.Sex != null)  
              parameters[5].Value = model.Sex;  
           else  
              parameters[5].Value = DBNull.Value;  
              
           if (model.Email != null)  
              parameters[6].Value = model.Email;  
           else  
              parameters[6].Value = DBNull.Value;  
              
           if (model.Tel != null)  
              parameters[7].Value = model.Tel;  
           else  
              parameters[7].Value = DBNull.Value;  
              
           if (model.MobilePhone != null)  
              parameters[8].Value = model.MobilePhone;  
           else  
              parameters[8].Value = DBNull.Value;  
              
           if (model.dept != null)  
              parameters[9].Value = model.dept;  
           else  
              parameters[9].Value = DBNull.Value;  
              
           if (model.Status != null)  
              parameters[10].Value = model.Status;  
           else  
              parameters[10].Value = DBNull.Value;  
              
           if (model.Birthday != null)  
              parameters[11].Value = model.Birthday;  
           else  
              parameters[11].Value = DBNull.Value;  
              
           if (model.Birthplace != null)  
              parameters[12].Value = model.Birthplace;  
           else  
              parameters[12].Value = DBNull.Value;  
              
           if (model.Address != null)  
              parameters[13].Value = model.Address;  
           else  
              parameters[13].Value = DBNull.Value;  
              
           if (model.Objects != null)  
              parameters[14].Value = model.Objects;  
           else  
              parameters[14].Value = DBNull.Value;  
              
           if (model.Siren != null)  
              parameters[15].Value = model.Siren;  
           else  
              parameters[15].Value = DBNull.Value;  
              
           if (model.IsLeader != null)  
              parameters[16].Value = model.IsLeader;  
           else  
              parameters[16].Value = DBNull.Value;  
              
           if (model.IDNumber != null)  
              parameters[17].Value = model.IDNumber;  
           else  
              parameters[17].Value = DBNull.Value;  
              
           if (model.Office != null)  
              parameters[18].Value = model.Office;  
           else  
              parameters[18].Value = DBNull.Value;  
              
           if (model.Responsibilities != null)  
              parameters[19].Value = model.Responsibilities;  
           else  
              parameters[19].Value = DBNull.Value;  
              
           if (model.VirtualNumber != null)  
              parameters[20].Value = model.VirtualNumber;  
           else  
              parameters[20].Value = DBNull.Value;  
              
           if (model.RoomNumber != null)  
              parameters[21].Value = model.RoomNumber;  
           else  
              parameters[21].Value = DBNull.Value;  
              
           if (model.DiskSize != null)  
              parameters[22].Value = model.DiskSize;  
           else  
              parameters[22].Value = DBNull.Value;  
              
           if (model.DeptTelephone != null)  
              parameters[23].Value = model.DeptTelephone;  
           else  
              parameters[23].Value = DBNull.Value;  
              
           if (model.Photo != null)  
              parameters[24].Value = model.Photo;  
           else  
              parameters[24].Value = DBNull.Value;  
              
              int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters); 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
  				return false; 
  			} 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 删除一条数据 
  		/// </summary> 
  		public bool Delete(string  Id) 
  		{ 
  			 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("delete from UserArchives "); 
  			strSql.Append(" where  Id=@Id"); 
  			SqlParameter[] parameters = {  new SqlParameter("@Id", SqlDbType.VarChar,50) };  
    parameters[0].Value = Id;  
   
  			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters); 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
  				return false; 
  			} 
  		} 
  		 
  		/// <summary> 
  		/// 批量删除一批数据 
  		/// </summary> 
  		public bool DeleteList(string Idlist ) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("delete from UserArchives "); 
  			strSql.Append(" where ID in ("+Idlist + ")  "); 
  			int rows=DbHelperSQL.ExecuteSql(strSql.ToString()); 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
  				return false; 
  			} 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 得到一个对象实体 
  		/// </summary> 
  		public UserArchives_Entity GetModel(string   Id) 
  		{ 
  			 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select  Id,UserId,Type,Pwd,Name,Sex,Email,Tel,MobilePhone,dept,Status,Birthday,Birthplace,Address,Objects,Siren,IsLeader,IDNumber,Office,Responsibilities,VirtualNumber,RoomNumber,DiskSize,DeptTelephone,Photo");	
		strSql.Append("  from UserArchives"); 
  			strSql.Append(" where  Id=@Id "); 
  			SqlParameter[] parameters = {  new SqlParameter("@Id", SqlDbType.VarChar,50) };  
    parameters[0].Value = Id;  
  			 
  			UserArchives_Entity model=new UserArchives_Entity(); 
  			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); 
  			 
  			if(ds!=null&&ds.Tables[0].Rows.Count>0) 
  			{ 
  		DataTable dt=ds.Tables[0];	  
  				model.Id= dt.Rows[0]["Id"].ToString(); 
  				if(dt.Rows[0]["UserId"]!=null&&dt.Rows[0]["UserId"].ToString()!="") 
  				{ 
  					model.UserId=int.Parse(dt.Rows[0]["UserId"].ToString()); 
  				} 
  				if(dt.Rows[0]["Type"]!=null&&dt.Rows[0]["Type"].ToString()!="") 
  				{ 
  					model.Type=int.Parse(dt.Rows[0]["Type"].ToString()); 
  				} 
  				model.Pwd= dt.Rows[0]["Pwd"].ToString(); 
  				model.Name= dt.Rows[0]["Name"].ToString(); 
  				model.Sex= dt.Rows[0]["Sex"].ToString(); 
  				model.Email= dt.Rows[0]["Email"].ToString(); 
  				model.Tel= dt.Rows[0]["Tel"].ToString(); 
  				model.MobilePhone= dt.Rows[0]["MobilePhone"].ToString(); 
  				if(dt.Rows[0]["dept"]!=null&&dt.Rows[0]["dept"].ToString()!="") 
  				{ 
  					model.dept=int.Parse(dt.Rows[0]["dept"].ToString()); 
  				} 
  				if(dt.Rows[0]["Status"]!=null&&dt.Rows[0]["Status"].ToString()!="") 
  				{ 
  					model.Status=int.Parse(dt.Rows[0]["Status"].ToString()); 
  				} 
  				if(dt.Rows[0]["Birthday"]!=null&&dt.Rows[0]["Birthday"].ToString()!="") 
  				{ 
  					model.Birthday=DateTime.Parse(dt.Rows[0]["Birthday"].ToString()); 
  				} 
  				model.Birthplace= dt.Rows[0]["Birthplace"].ToString(); 
  				model.Address= dt.Rows[0]["Address"].ToString(); 
  				model.Objects= dt.Rows[0]["Objects"].ToString(); 
  				model.Siren= dt.Rows[0]["Siren"].ToString(); 
  				if(dt.Rows[0]["IsLeader"]!=null&&dt.Rows[0]["IsLeader"].ToString()!="") 
  				{ 
  					model.IsLeader=int.Parse(dt.Rows[0]["IsLeader"].ToString()); 
  				} 
  				model.IDNumber= dt.Rows[0]["IDNumber"].ToString(); 
  				model.Office= dt.Rows[0]["Office"].ToString(); 
  				model.Responsibilities= dt.Rows[0]["Responsibilities"].ToString(); 
  				model.VirtualNumber= dt.Rows[0]["VirtualNumber"].ToString(); 
  				model.RoomNumber= dt.Rows[0]["RoomNumber"].ToString(); 
  				if(dt.Rows[0]["DiskSize"]!=null&&dt.Rows[0]["DiskSize"].ToString()!="") 
  				{ 
  					model.DiskSize=decimal.Parse(dt.Rows[0]["DiskSize"].ToString()); 
  				} 
  				model.DeptTelephone= dt.Rows[0]["DeptTelephone"].ToString(); 
  				model.Photo= dt.Rows[0]["Photo"].ToString(); 
  				return model; 
  			} 
  			else 
  			{ 
  				return null; 
  			} 
  		} 
  		 
  		/// <summary> 
  		/// 分页获取数据列表 
  		/// </summary> 
  		public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  		 strSql.Append("SELECT * FROM ( "); 
  		 strSql.Append(" SELECT ROW_NUMBER() OVER ("); 
  if (!string.IsNullOrEmpty(orderby.Trim())) 
 { 
    strSql.Append("order by T." + orderby); 
 } 
else  
 { 
     strSql.Append("order by T.Id desc"); 
 } 
		 strSql.Append(")AS Row, T.*  from UserArchives T "); 
  		 if (!string.IsNullOrEmpty(strWhere.Trim()))  
  			{ 
  			 strSql.Append(" WHERE " + strWhere); 
  			} 
  		    strSql.Append(" ) TT"); 
  	        strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);			return DbHelperSQL.Query(strSql.ToString()); 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public DataSet GetList(string strWhere) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select * "); 
  			strSql.Append(" FROM UserArchives "); 
  			if(strWhere.Trim()!="") 
  			{ 
  				strSql.Append(" where "+strWhere); 
  			} 
  			return DbHelperSQL.Query(strSql.ToString()); 
  		} 
  		 
  		/// <summary> 
  		/// 获得前几行数据 
  		/// </summary> 
  		public DataSet GetList(int Top,string strWhere,string filedOrder) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select "); 
  			if(Top>0) 
  			{ 
  				strSql.Append(" top "+Top.ToString()); 
  			} 
  			strSql.Append(" * "); 
  			strSql.Append(" FROM UserArchives "); 
  			if(strWhere.Trim()!="") 
  			{ 
  				strSql.Append(" where "+strWhere); 
  			} 
  			strSql.Append(" order by " + filedOrder); 
  			return DbHelperSQL.Query(strSql.ToString()); 
  		} 
  		 
  		/// <summary> 
  		/// 获得记录条数 
  		/// </summary> 
  		public int GetRecordCount(string strWhere) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select count(1) "); 
  			strSql.Append(" FROM UserArchives "); 
  			if(strWhere.Trim()!="") 
  			{ 
  				strSql.Append(" where "+strWhere); 
  			} 
  		   object obj=	DbHelperSQL.GetSingle(strSql.ToString()); 
  			if(obj!=null && obj.ToString()!="") 
  			{ 
              	return Convert.ToInt32(obj); 
  			} 
  			else 
  			return 0; 
  		} 
   
      
  	} 
  
}
